package me.moscrop.RootCommand.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Feed{
	
	
	public static boolean feedSender(CommandSender sender, String[] args)
	{
		Player personToFeed;
	
		//if there is arguments
		if(args.length > 0 && (args[0].contentEquals("") == false))
		{
			//get the user and heal them
			personToFeed = sender.getServer().getPlayer(args[0]);
			//if player exists heal them
			if(personToFeed != null)
			{
				((Player) sender).sendMessage(ChatColor.GREEN + personToFeed.getDisplayName() +" now has a full tummy.");
				personToFeed.sendMessage(ChatColor.GREEN + "You now have a full tummy.");
				personToFeed.setFoodLevel(20); // heal and verbose
				return true;
			}else{
				((Player) sender).sendMessage(ChatColor.RED + args[0] + " doesnt exist.");
				return true;
			}
		}
	
		//From this point on theres no args so the player wants to feel them self
	
		if((sender instanceof Player) == false)
		{
			sender.sendMessage("This isnt a command for the console silly.");
			return false;
		}
	
		if(args.length == 0)
		{
			personToFeed = (Player) sender;
			personToFeed.sendMessage(ChatColor.GREEN + "You now have a full tummy.");;
			personToFeed.setFoodLevel(20);
			//heal and verbose
		}
		return true;
	}
}
